#ifndef _UNTIL_H_
#define _UNTIL_H_

#include <vector>

struct Point
{
	int x, y;
	Point(): x(0), y(0){};
};

struct Rectangle
{
	int x, y, w, h;
	Rectangle(): x(-1), y(-1), w(-1), h(-1){};
};

class Util
{
public:
	static Util* instant;

	Util();
	~Util();

	static Util* getInstant();

	//Check exist file?
	int isExist( char* filename );
	
	//cut space before of string
	char* cutSpaceBefore( char * str );

	//convert char ABCDF to number
	int switchCharToNumver ( char ch );

	//Ox1006 -> 6 not use 0x1 only conver 006
	int convertHexToDec (char* hec );

	//replace a char in str
	char* replaceChar ( char* str, char ch , char ch_replace);

	//convert Dec to char
	char* convertDecToChar ( int num );

	//string contain subString?
	int stringContainString ( char* str, char* subStr );

	//clean all character and keep number only ex abcd 1 3 -4 - > 1 3 -4
	char* keepNumberInString ( char* str );

	//get image name of sprite with extend ex menu.png
	char* getImageNameWithExtent ( char* spriteName );

	//get image name of sprite with non extend ex menu
	char* getImageName ( char* spriteName );

	//get size of image
	Point getImageSize ( char* spriteName );

	//get max module can // return -1 if not exist
	int getModuleMax ( char* spriteName );

	//get max frame can // return -1 if not exist
	int getFrameMax ( char* spriteName );

	//get max anim can // return -1 if not exist
	int getAnimMax ( char* spriteName );

	//get gts file
	char* getGtsFile ( char* guiName );

	//get sprite list
	char* getSpriteListFile ( char* gtsFile );

	//get level file array
	std::vector <char* > getLevelFileName ( char* guiName );  

	//get template ID
	int getTemplateID ( char* gtsFile, char* _template );

	//get max template
	int getTemplateMax ( char* gtsFile );

	//get gui level max
	int getGuiLevelMax ( char* guiName );
};

#endif